package com.zdxlz.mongodbDemo.pojo;

import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.springframework.data.mongodb.core.mapping.Field;
import org.springframework.data.mongodb.core.mapping.FieldType;

import java.math.BigDecimal;

@Data
@NoArgsConstructor
@Accessors(chain = true)
// 若未加 @Document ，该 bean save 到 mongo 的 comment collection
// @Document
public class House {
    /**
     * 主键_id
     */
    private String id;
    /**
     * 地址
     */
    private String address;
    /**
     * 手机号
     */
    @Field(targetType = FieldType.DECIMAL128)
    private BigDecimal price;
    /**
     * 是否已卖出
     */
    private boolean saled;
    /**
     * 指标
     */
    private Indicators indicators;

    @Data
    @NoArgsConstructor
    @Accessors(chain = true)
    public static class Indicators{
        private Double height;
        private Double length;
        private Double width;
    }
}
